package io.kiki.sba.registry.store.jdbc.config;

import io.kiki.sba.registry.util.OsUtils;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;


@ConfigurationProperties(prefix = MetadataConfigBean.PRE_FIX)
public class MetadataConfigBean implements MetadataConfig {

    public static final String PRE_FIX = "metadata.server";

    @Getter
    private int revisionRenewIntervalMinutes = 60 * 3;
    @Getter
    private int interfaceAppsIndexRenewIntervalMinutes = 60 * 3;

    private int interfaceAppsExecutorPoolSize = OsUtils.getCpuCount() * 3;
    private int interfaceAppsExecutorQueueSize = 1000;

    private int clientManagerExecutorPoolSize = OsUtils.getCpuCount() * 6;
    private int clientManagerExecutorQueueSize = 3000;

    public void setRevisionRenewIntervalMinutes(int revisionRenewIntervalMinutes) {
        this.revisionRenewIntervalMinutes = revisionRenewIntervalMinutes;
    }

    public void setInterfaceAppsIndexRenewIntervalMinutes(int interfaceAppsIndexRenewIntervalMinutes) {
        this.interfaceAppsIndexRenewIntervalMinutes = interfaceAppsIndexRenewIntervalMinutes;
    }

    @Override
    public int getInterfaceAppsExecutorPoolSize() {
        return interfaceAppsExecutorPoolSize;
    }


    public void setInterfaceAppsExecutorPoolSize(int interfaceAppsExecutorPoolSize) {
        this.interfaceAppsExecutorPoolSize = interfaceAppsExecutorPoolSize;
    }

    @Override
    public int getInterfaceAppsExecutorQueueSize() {
        return interfaceAppsExecutorQueueSize;
    }


    public void setInterfaceAppsExecutorQueueSize(int interfaceAppsExecutorQueueSize) {
        this.interfaceAppsExecutorQueueSize = interfaceAppsExecutorQueueSize;
    }

    @Override
    public int getClientManagerExecutorPoolSize() {
        return clientManagerExecutorPoolSize;
    }


    public void setClientManagerExecutorPoolSize(int clientManagerExecutorPoolSize) {
        this.clientManagerExecutorPoolSize = clientManagerExecutorPoolSize;
    }

    @Override
    public int getClientManagerExecutorQueueSize() {
        return clientManagerExecutorQueueSize;
    }


    public void setClientManagerExecutorQueueSize(int clientManagerExecutorQueueSize) {
        this.clientManagerExecutorQueueSize = clientManagerExecutorQueueSize;
    }
}
